#pragma once

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the ATASHD3D_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// ATASHD3D_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef ATASHD3D_EXPORTS
#define ATASHD3D_API __declspec(dllexport)
#else
#define ATASHD3D_API __declspec(dllimport)
#endif

#include <d3d9.h>
#include <DXGIFormat.h>

#ifdef __cplusplus
extern "C" {
#endif

DECLARE_HANDLE(HCAPTOR);

struct RPB_CreateCaptor
{
	char szDeviceName[32];
	HCAPTOR hCaptor;
	HANDLE hMutex;
	HANDLE hFileMapping;
	HWND hWndNotified;
};

struct FMH_Capture
{
	DWORD dwSize; //the size includes region and image
	RPB_CreateCaptor rpbCreate;
	BOOL bDirty;
	HANDLE hFileMapping;
	DWORD dwOffsetRegion;
	DWORD dwOffsetImage;

	union
	{
		D3DFORMAT d3dfmt;
		DXGI_FORMAT dxgifmt;
	}dxfmt;

	DWORD dwWidth;
	DWORD dwHeight;
	INT iPitch;
};

CONST int CAPTURE_HEADER_SIZE = 1024;

ATASHD3D_API BOOL RTInitialize(PVOID pParameter);
ATASHD3D_API BOOL RTFinalize(PVOID pParameter);
ATASHD3D_API BOOL RTCreateCaptor(RPB_CreateCaptor* pParameter);
ATASHD3D_API BOOL RTDestroyCaptor(HCAPTOR hCaptor);

const LPTSTR PREFIX_WINDOW_CLASS = TEXT("ASD3D");
const LPTSTR PREFIX_MAPPING_FILE = TEXT("ASD3DMAP");

#define WM_DESTROYCAPTOR	WM_USER+100
#define WM_CREATECAPTOR		WM_USER+101

extern HWND g_hwndFocus;
#ifdef __cplusplus
}
#endif
